package com.medata.service.impl;

import com.medata.dataObject.Corrects;
import com.medata.repository.CorrectsRepository;
import com.medata.service.CorrectsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;
import java.util.List;

/**
 * @author ：zb
 * @date ：Created in 2019/10/11 0011 16:08
 * @description：
 */
@Service
public class CorrectsServiceImpl implements CorrectsService {
    @Autowired
    private CorrectsRepository repository;

    @Override
    public Page<Corrects> findByName(String name, Pageable pageable) {
        return repository.findByName(name,pageable);
    }

    @Override
    public List<Corrects> findAll() {
        return repository.findAll();
    }

    @Override
    public Page<Corrects> findAll(Pageable pageable) {
        return repository.findAll(pageable);
    }

    @Override
    @Transactional
    public void deleteAll() {
        repository.deleteAll();
    }

    @Override
    @Transactional
    public void delete(Integer id) {
        repository.deleteById(id);
    }
}
